-
-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH/BUG groupby nth now filters, works with DataFrames #6569
Conversation
Also note old behaviour was not stable/correct for negative (now fixed with PR&dropna):
|
If you get around to it; I suspect the new method is MUCH faster than the old, so maybe add a vbench |
will append a vbench. Is much faster except when applying to dataframe with dropna (old-style) it's a little slower, but that was previously borked. Um, obviously there is overlap with first and last methods, they be got with nth(0) and nth(-1) but not tested the differences yet... you reckon these should change too? |
yes I think you should blow away first/last code and just alias them to reminds me that pls put some tests that deal with different types (because first/last have this convert arg..though not sure why) |
though maybe |
there was/is a weird test for types of first/last/nth, I tweaked it a little but is still there... I can iterate tests over a few of the same df (but with different column types), is that what you mean? Yea, re fast path (will see how they compare the the cumcount for now)... |
@@ -165,10 +164,10 @@ def test_first_last_nth(self): | |||
grouped['B'].last() | |||
grouped['B'].nth(0) | |||
|
|||
self.df['B'][self.df['A'] == 'foo'] = np.nan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm.....this should have actually raised a SettingWithCopy (as the test suite sets it to raise)...wierd
Added vbench, is about 40 times faster with not-including the setup of the groupby (which is included in the bench) |
awesome! |
ENH/BUG groupby nth now filters, works with DataFrames
fixes #5552
partial for #5264